import { defineStore } from 'pinia'

export const COLORS = [
  {
    color: "red",
    flake: "silver",
    perl: "red",
  },
  {
    color: "black",
    flake: "silver",
    perl: "silver",
  },
  {
    color: "#004225",
    flake: "#199861",
    perl: "#01632a",
  },
  {
    color: "#F8CD02",
    flake: "#fae20c",
    perl: "#ffc400",
  },
  {
    color: "#9a02f8",
    flake: "#edcfff",
    perl: "#e088f9",
  },
  {
    color: "#fafafa",
    flake: "#fafafa",
    perl: "#fafafa",
  },
  {
    color: "#7acaff",
    flake: "#ffffff",
    perl: "#013455",
  },
  {
    color: "#ff61bd",
    flake: "#ffbde3",
    perl: "#ffbde3",
  },
];

export const CAMERAS = ["Side", "Closeup", "Front", "Top", "Rear "];

interface AppState {
  colorIndex: number;
  currentCamera: number;
  useAdvancedMaterial: boolean;
}

export const useAppStore = defineStore('app', {
  state: (): AppState => ({
    colorIndex: 0,
    currentCamera: 0,
    useAdvancedMaterial: true, // 默认使用高级材质
  }),
  
  actions: {
    setColorIndex(index: number) {
      this.colorIndex = index;
    },
    setCurrentCamera(index: number) {
      this.currentCamera = index;
    },
    toggleMaterial() {
      this.useAdvancedMaterial = !this.useAdvancedMaterial;
    },
  },
});
